---
title: 'Test'
permalink: "/development/test.html"
layout: main-layout
stylesheets: ["/vendor/mocha.css"]
scripts:
  [
    "/vendor/mocha.js",
    "/vendor/chai.js",
  ]
---

<script>
  mocha.setup({
    ui: "bdd",
    global: [
      "TextEncoder", // Not really a leak, we put it back after deleting
      "peggyVersion", // Intentional
    ],
    timeout: "5000",
  });
  mocha.checkLeaks();
</script>
<script src='/js/test-bundle.min.js'></script>
<style>
  .hidden {
    display: none;
  }
</style>

<div id='results' class="hidden"></div>
<div id="mocha"></div>

<script class="mocha-exec">
  mocha.run(failures => {
    const result = failures === 0 ? 'PASS' : 'FAIL';
    // If you change the next line, please modify the regexp in web-test/index.js
    const status = result + ': ' + failures + ' failures. Peggy Version: ' + globalThis.peggyVersion;
    console.log(status);
    const div = document.getElementById('results');
    div.innerHTML = status;
    div.classList.remove('hidden');
  });
</script>
